﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace 继承01
{
    // Cat类是派生类、子类，通过在类名后边追加冒号和基类名称来指定基类
    class Cat : Animal
    {
        public double Weight { get; set; }
        public Cat()
        {
            Console.WriteLine("Cat无参构造");
        }

        // 这里的this和base表示，分别调用基类的构造器和本身的构造器
        public Cat(int idid, string name) : base(idid, name)
        {
            //ID = idid;
            //Name = name;
            Console.WriteLine("Cat——2个有参构造");
        }

        public Cat(int id, string name, double weight) :this(id, name)
        {
            Weight = weight;
            Console.WriteLine("Cat——3个有参构造");
        }

        public void CatchMouse()
        {
            Run();
            Console.WriteLine(Name + "抓老鼠....");
        }
    }
}
